package com.kedou.app;

import com.kedou.fragment.ProjectIntroductionFragment;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * 认筹成功后看到的项目详情
 * 
 * @author zhouchao
 * 
 */
public class FundSuccessProjectDetailActivity extends FragmentActivity
		implements OnClickListener {
	/**
	 * 左侧 返回按钮
	 */
	private Button mBtnBack;
	/**
	 * 中间 Title
	 */
	private TextView mTvTitle;
	/**
	 * 右侧 设置
	 */
	private ImageView mImgSetting;
	/**
	 * 中间Fragment
	 */
	private Fragment mContent;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_fundsuccessprojectdetail);
		initView();
		setListener();
		initFragment();
	}

	/**
	 * 初始化View
	 */
	private void initView() {
		mBtnBack = (Button) findViewById(R.id.btn_back);
		mBtnBack.setVisibility(View.VISIBLE);
		mTvTitle = (TextView) findViewById(R.id.title);
		mTvTitle.setText(R.string.title_renchou_success_project_detail);
		mImgSetting = (ImageView) findViewById(R.id.img_setting);
		mImgSetting.setVisibility(View.VISIBLE);
	}

	/**
	 * 设置监听器
	 */
	private void setListener() {
		mBtnBack.setOnClickListener(this);
	}

	/**
	 * 初始化Fragment
	 */
	private void initFragment() {
		mContent = new ProjectIntroductionFragment();
		getSupportFragmentManager().beginTransaction()
				.replace(R.id.content, mContent).commit();
	}

	/**
	 * 点击切换中间内容
	 */
	public void switchContent(Fragment fragment) {
		mContent = fragment;
		getSupportFragmentManager().beginTransaction()
				.replace(R.id.content, fragment).commit();
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_back:
			finish();
			break;
		}
	}
}
